package com.inspinia.base.util;


import com.inspinia.base.common.model.NameCodeEnum;

/**
 * excel的文件后缀
 */
public enum ExcelFileSuffix implements NameCodeEnum {
    xls(1, ".xls"),
    xlsx(2, ".xlsx");

    private final int code;
    private final String name;

    ExcelFileSuffix(int code, String name) {
        this.code = code;
        this.name = name;
    }

    @Override
    public int getCode() {
        return this.code;
    }

    @Override
    public String getName() {
        return this.name;
    }

    public static ExcelFileSuffix valueOf(int code) {
        for (ExcelFileSuffix rs : ExcelFileSuffix.values()) {
            if (rs.getCode() == code) {
                return rs;
            }
        }
        return null;
    }
}
